# Copyright 2020 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#

########################################################################
# Check if there is C++ code at all
########################################################################
if(NOT dvbs2acm_sources)
    MESSAGE(STATUS "No C++ sources... skipping python bindings")
    return()
endif(NOT dvbs2acm_sources)

########################################################################
# Check for pygccxml
########################################################################
GR_PYTHON_CHECK_MODULE_RAW(
    "pygccxml"
    "import pygccxml"
    PYGCCXML_FOUND
    )

include(GrPybind)

########################################################################
# Python Bindings
########################################################################
list(APPEND dvbs2acm_python_files
    bbheader_bb_python.cc
    bbscrambler_bb_python.cc
    bch_encoder_bb_python.cc
    interleaver_bb_python.cc
    modulator_bc_python.cc
    physical_cc_python.cc
    rotator_cc_python.cc
    symbol_sync_cc_python.cc
    plsync_cc_python.cc
    ldpc_encoder_bb_python.cc
    ldpc_decoder_bb_python.cc
    bch_decoder_bb_python.cc
    bbdescrambler_bb_python.cc
    bbdeheader_bb_python.cc
    dvbs2_config_python.cc
    demodulator_cb_python.cc
    deinterleaver_bb_python.cc
    ldpc_decoder_hybrid_cb_python.cc python_bindings.cc)

GR_PYBIND_MAKE_OOT(dvbs2acm
   ../../..
   gr::dvbs2acm
   "${dvbs2acm_python_files}")

# copy in bindings .so file for use in QA test module
add_custom_target(
  copy_bindings_for_tests ALL
  COMMAND
    ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_BINARY_DIR}/*.so"
    ${CMAKE_BINARY_DIR}/test_modules/gnuradio/dvbs2acm/
  DEPENDS dvbs2acm_python)

install(TARGETS dvbs2acm_python DESTINATION ${GR_PYTHON_DIR}/gnuradio/dvbs2acm COMPONENT pythonapi)
